Page({
  data: {
 name:'',
  staffid:'',
  lst:{


  },


  },
  onLoad(){ 
var that=this;

  dd.getStorage({
  key: 'staffid',
  success: function(res) 
  { 
    //console.log(res.data);
  that.setData({

   staffid:res.data

  });
  dd.httpRequest({

        
          //提交工号和授权码，如果授权码和工号对上了就返回姓名，然后保存工号到缓存
          //url: 'https://oapi.dingtalk.com/user/getuserinfo?access_token=' + access_token + '&code=' + code,
        
          url:'http://ding.tida-lighting.com/api/Approve/MyApply?empid='+res.data,
          success: function (res) {
         
         // console.log(that.data.staffid);
          that.setData({
             lst:res.data,
            
          });

          console.log(res.data);
         },
        fail: (err) => {
           //dd.alert({content: JSON.stringify(err)})
           console.log(err);
        }

     });//发起结束
  },
  fail: function(res){
    dd.alert({content: res.errorMessage});
  }
});

  dd.getStorage({
  key: 'name',
  success: function(res) {
   // console.log(res.data);
  that.setData({
   name:res.data

  });
  },
  fail: function(res){
    dd.alert({content: res.errorMessage});
  }
});




  },detail:function(e)
  {



   dd.navigateTo({
        url:'../MyApplyDetail/MyApplyDetail?id='+e.currentTarget.dataset.value,
         });

    
  }
  ,back:function(e)
  {

   var  id =e.target.dataset.value;
   console.log(id);

     dd.httpRequest({

        
          //提交工号和授权码，如果授权码和工号对上了就返回姓名，然后保存工号到缓存
          //url: 'https://oapi.dingtalk.com/user/getuserinfo?access_token=' + access_token + '&code=' + code,
        
          url:'http://ding.tida-lighting.com/api/Approve/back?id='+id,
          success: function (res) {
         

          console.log(id);
          dd.showToast({
           content:res.data.msg,       
 
          });
         
                    dd.navigateBack({
      delta: 1
     });

          console.log(res.data);
         },
        fail: (err) => {
           //dd.alert({content: JSON.stringify(err)})
           console.log(err);
        }

     });


  },bks:function()
  {




dd.navigateBack({
      delta: 3
     });

  
 

  }
 

});
